<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>货品信息列表</title>
<link href="<%=path%>/css/core.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/pagination.css" rel="stylesheet"
	type="text/css" />
<link href="<%=path%>/css/list.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/xToolbar.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/jquery-impromptu.css" rel="stylesheet"
	type="text/css" />
</head>
<body>
	<div id="toolbar"></div>
	<form id="listForm"
		action="<%=path%>/product/product/listPagination.t4m" method="post">
		<table id="titleTable" cellpadding="0" cellspacing="0">
	        <tr>
	          <td><input type="checkbox" id="allBox" /></td>
	          <td>编号</td>
	          <td>名称</td>
	          <td>规格型号</td>
	          <td>生产商</td>
	        </tr>
		</table>
		<table id="dataTable" cellpadding="0" cellspacing="0">
			<s:iterator id="product" value="page.list" status="i">
          <tr class="row">
            <td class="box">
              <input type="checkbox" name="idList" value="<s:property value="#product.id"/>" />
            </td>
            <td><span><s:property value="#product.code" /></span></td>
            <td><span><s:property value="#product.name" /></span></td>
            <td><span><s:property value="#product.standard" /></span></td>
            <td><span><s:property value="#product.manufacturer" /></span></td>
          </tr>
        </s:iterator>
		</table>
		<s:include value="/share/pagebar.jsp" />
	</form>

	<script src="<%=path%>/js/core.js" type="text/javascript"></script>
	<script src="<%=path%>/js/share.js" type="text/javascript"></script>
	<script src="<%=path%>/js/jquery.js" type="text/javascript"></script>
	<script src="<%=path%>/js/Grid.js" type="text/javascript"></script>
	<script src="<%=path%>/js/BoxSelect.js" type="text/javascript"></script>
	<script src="<%=path%>/js/xToolbar.js" type="text/javascript"></script>
	<script src="<%=path%>/js/xToolbar.items.js" type="text/javascript"></script>
	<script src="<%=path%>/js/jquery-impromptu.js" type="text/javascript"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		new Toolbar({
	        renderTo : 'toolbar',
	        icon: '../../image/op.gif',
	        items : [{
	          type : 'button',
	          text : '选取',
	          useable : 'T',
	          position: {
	            a: '0px 0px',
	            b: '0px -120px'
	          },
	          handler : function(){
	            if(getFirstID()) {
	              var dataArray = [];
	              var datas = $('#dataTable tr.selected');
	              datas.each(function(i){
	                var tds = $('td', this);
	                dataArray[i] = {
	                  id: tds.eq(0).children('input[name="idList"]').val(),
	                  code: tds.eq(1).text(),
	                  name: tds.eq(2).text(),
	                  standard: tds.eq(3).text(),
	                  manufacturer: tds.eq(4).text()
	                };
	              });
	              parent.opener.addData(dataArray);
	              parent.close();
	            }
	          }
	        }]
	      });
	      
	      new Grid({
	        titleTable:'titleTable',
	        dataTable:'dataTable',
	        widths : [30,140,140,140,140],
	        height : function(){return getGridHeight({toolbarId:'toolbar',hasPage:true});}
	      });
	      
	      new BoxSelect({
	        allId : 'allBox',
	        boxName : 'idList'
	      });
	      
	      loadReady();
	    });
    </script>
</body>
</html>